<?php
/**
 * Created by PhpStorm.
 * User: xiaoxin
 * Date: 2018/10/20 0020
 * Time: 11:29
 */

namespace app\index\validate;
use think\Validate;
class PhoneCheckCode extends Validate
{
	protected $rule =   [
		'captcha'=>'require|captcha|text',
		'phone'=>'require',
	];
	protected $message  =   [
		'captcha.require'=>'请填写验证码',
		'captcha'=>'验证码错误',
		'phone'=>'请填写您手机',
	];
	public function text($v,$rule,$data){
		$code = session('code');
		if ($code && time()-$code['ctime']<60){
			return  '一分钟之内不能重新发送';
		}
		return true;
	}
}